package unit3;

import java.util.Scanner;


/**
 * 
 * @author asus
 *
 */
public class LotteryOdds {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner in=new Scanner(System.in);
		
		System.out.println("How many numbers do you need to draw?");
		int k=in.nextInt();
		
		System.out.println("What is the highest numbers you can draw?");
		int n=in.nextInt();
		
		/*
		 * compute binomial coefficient n*(n-1)*(n-2)*...*(n-k+1)/(1*2*3*4*5*...*k)
		 */
		int lotteryOdds=1;
		for(int i=1;i<=k;i++){
				lotteryOdds=lotteryOdds*(n-i+1)/i;
		}
		System.out.println("You odds are 1 in "+lotteryOdds+". Good Luck!");
	}
}
